﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace B.W.passport.IBaseRepisitory
{
    public interface IBaseRepisitory<T> where T : class
    {
        /// <summary>
        /// 查询全部
        /// </summary>
        /// <returns></returns>
         IQueryable<T> GetAll();


        /// <summary>
        /// 根据条件查询
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        IQueryable<T> Find(Expression<Func<T, bool>> predicate);


        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns>返回受影响行数</returns>
          Task<int> AddAsync(T entity);



        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="entity"></param>
      


        /// <summary>
        /// 根据单个实体删除
        /// </summary>
        /// <param name="entity">要删除的实体</param>
        /// <returns>受影响的行数</returns>
        Task<int> DeleteAsync(T entity);


        ///// <summary>
        /////  删除
        ///// </summary>
        ///// <param name="entity"></param>
        ///// <returns></returns>
        //public  async Task<int> Update(T entity)
        //{
        //    db.Set<T>().Update(entity);
        //    return db.SaveChanges();
        //}



        Task<List<T>> GetAllAsync(Expression<Func<T, bool>> param);

        Task<int> UpdateDataAsync(T entity);

    }
}

